<?php
namespace app\admin\controller;
use app\self\controller\Extend;
use think\Db;

class Log extends Extend
{
    public $database = 's_log';

    public $type = '系统日志';


    public function searchWhere()
    {

        $search = [
            ['field'=>'type','name'=>'类型','type'=>'select'],
            ['field'=>'content','name'=>'内容'],
            ['field'=>'create_time','name'=>'时间','type'=>'date'],
        ];
        $this->assign('search',$search);
        $this->assign('searchJs',json_encode($search));
        $this->selectData();

    }

    /**
     * use  搜索下拉选项
     * by   hugh
     * time 2020/12/28 15:23
     */
    public function selectData()
    {
        $log = DB::name('s_log')
             ->group('type')
             ->column('type');
        $data['type'] = [

        ];
        foreach($log as $k =>$v)
        {
            $data['type'][] = [
                'value'=>$v,'key'=>$v,
            ];
        }

        $this->assign('selectData',$data);
    }


    public function mapSelf()
    {
        return [];
    }
}
